using System.Collections.ObjectModel;
using T4UtilityBelt.Writers;

namespace T4UtilityBelt.UxDesigns
{

    public class ContentElementCollection<T> : Collection<T>
        where T : ContentElement
    {
        #region Render Methods

        public void RenderUiXml(CodeWriter writer)
        {
            foreach (T c in this)
            {
                c.RenderUiXml(writer);
            }
        }

        public string RenderUiXml(Platforms platform)
        {
            CodeWriter writer = new CodeWriter(platform);
            RenderUiXml(writer);
            return writer.ToString();
        }

        public void RenderViewModelCs(CodeWriter writer)
        {
            foreach (T c in this)
            {
                c.RenderViewModelCs(writer);
            }
        }

        public string RenderViewModelCs(Platforms platform)
        {
            CodeWriter writer = new CodeWriter(platform);
            RenderViewModelCs(writer);
            return writer.ToString();
        }

        #endregion
    }

    public class ContentElementCollection : ContentElementCollection<ContentElement>
    {
    }

}